package com.example.fourcomponentsdemo.service;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;

import com.example.fourcomponentsdemo.R;

/**
 * Created by tangjiangxu on 10/23/17.
 */

public class ServiceActivity extends Activity{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    private void startService() {
        Intent intent = new Intent(ServiceActivity.this, TestService.class);
        startService(intent);
    }

    ServiceConnection connection = new ServiceConnection() {
        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {

        }

        @Override
        public void onServiceDisconnected(ComponentName name) {

        }
    };

    private void bindService() {
        Intent intent = new Intent(ServiceActivity.this, TestService.class);
        bindService(intent, connection, BIND_AUTO_CREATE)
    }
}
